package com.study.blog.controller;

import com.study.blog.common.result.BaseResponse;
import com.study.blog.model.vo.CategoryVO;
import com.study.blog.service.CategoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@Api(tags = "分类管理")
@RestController
@RequestMapping("/category")
public class CategoryController {


    @Autowired
    private CategoryService categoryService;


    @ApiOperation(value = "获取所有分类")
    @GetMapping("")
    public BaseResponse<List<CategoryVO>> getAllCategory() {
        List<CategoryVO> allCategory = categoryService.getAllCategory();
        return BaseResponse.success(allCategory);
    }
}
